package com.auxgroup.smarthome.job.timingcontrol;

import com.auxgroup.smarthome.job.CommonScheduler;
import com.dangdang.ddframe.job.lite.api.JobScheduler;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class AppScheduleScheduler extends CommonScheduler {

    @Bean(initMethod = "init")
    public JobScheduler appScheduleJobScheduler(final AppScheduleJob simpleJob,@Value("${appScheduleJob.jobName}") final String jobName,
                                           @Value("${appScheduleJob.cron}") final String cron,
                                           @Value("${appScheduleJob.shardingTotalCount}") final int shardingTotalCount,
                                           @Value("${appScheduleJob.shardingItemParameters}") final String shardingItemParameters) {
        return createJobScheduler(simpleJob,jobName,cron,shardingTotalCount,shardingItemParameters);
    }
}
